<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
    <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<jsp:include page="/_meta.jsp" />
<link href="/lib/easyui/themes/default/easyui.css" rel="stylesheet"
	type="text/css">
<link href="/lib/easyui/themes/icon.css" rel="stylesheet"
	type="text/css">
<title>仓库管理</title>
</head>
<body>
	<nav class="breadcrumb">
		<i class="Hui-iconfont">&#xe67f;</i> 首页 <span class="c-gray en">&gt;</span>
		资料管理 <span class="c-gray en">&gt;</span>仓库资料 <a
			class="btn btn-success radius r"
			style="line-height: 1.6em; margin-top: 3px"
			href="javascript:location.replace(location.href);" title="刷新"><i
			class="Hui-iconfont">&#xe68f;</i></a>
	</nav>
	<div class="cl pd-5 bg-1 bk-gray mt-20">
		<span class="l">
			<a href="javascript:;" onclick="storage_add('添加仓库','AddStorage.jsp','1000','600')" class="btn btn-primary radius">
				<i class="Hui-iconfont">&#xe600;</i>新增仓库
			</a>
		</span> &nbsp;
	</div>
	<div class="mt-20">
		<!-- 空行 -->
		<div class="page-container "
			style="width: 1500px; height: 100%; margin: 20px auto">
			<table id="SockTable" class="easyui-datagrid" url="/StorageServlet" rownumber="true" pagination="true">
			</table>
			<div id="datetool" style="padding: 10px">
				
				<select id="search">
					<option value="stoId">仓库编号</option>
					<option value="stoName">仓库名称</option>
					<option value="name">负责人</option>
					<option value="stoAddr">仓库地址</option>
					<option value="stoPs">备注</option>
				</select>
				搜索:<input id="searchText" style="line-height: 26px;border:1px;solid:#ccc" />
				<a href="#" class="easyui-linkbutton" iconCls="icon-search" onclick="doSearch()">查找</a>
			</div>
		</div>
		<jsp:include page="/_footer.jsp" />
		<script type="text/javascript" src="/lib/laypage/1.2/laypage.js"></script>
		<script src="/lib/easyui/jquery.easyui.min.js"></script>
		<script src="/lib/easyui/locale/easyui-lang-zh_CN.js"></script>
		<!--请在下方写此页面业务相关的脚本-->
		<script type="text/javascript">
		$(document).ready(function() {
			$('#searchText').keyup(function(event) {
				$('#SockTable').datagrid('load', {
					search : $('#search').val(),
					searchText : $('#searchText').val()
				});
			});
			
		});
		function doSearch() {
			$('#SockTable').datagrid('load', {
				search : $('#search').val(),
				searchText : $('#searchText').val()
			});
		}
		/*仓库-添加*/
		function storage_add(title,url,w,h){
			layer_show(title,url,w,h);
		}
		$($(function() {
			$("#SockTable")
					.datagrid(
							{
								onClickRow : function(index, field, value) {

									$(this).datagrid('beginEdit', index);
									var ed = $(this).datagrid('getEdit', {
										index : index,
										field : field
									});
									$(ed.target).focus();
								},
								title : '仓库列表',
								iconCls : 'icon-edit',
								width : 1500,
								height : 350,
								singleSelect : true,
								toolbar : '#datetool',
								url : '/StorageServlet',
								columns : [ [
										{
											field : 'stoId',
											title : '仓库id',
											width : 180,
											align : 'center'
										},
										{
											field : 'stoName',
											title : '仓库名称',
											width : 180,
											align : 'center'
										},
										{
											field : 'empName',
											title : '负责人',
											width : 180,
											align : 'center'
										},
										{
											field : 'stoAddr',
											title : '仓库地址',
											width : 80,
											align : 'center'
										},
										{
											field : 'isDefaultSto',
											title : '是否默认',
											width : 80
										},
										{
											field : 'stoPs',
											title : '仓库备注',
											width : 80,
											align : 'center',
											editor : {
												type : 'text',
												options : {
													on : 'P',
													off : ''
												}
											}
										}] ],
								onBeforeEdit : function(index, row) {
									row.editing = true;
									updateActions(index);
								},
								onAfterEdit : function(index, row) {
									row.editing = false;
									updateActions(index);
								},
								onCancelEdit : function(index, row) {
									row.editing = false;
									updateActions(index);
								}
							});
		}));
		</script>

</body>
</html>